package br.ufpe.cin.analysis.plugin.charts;

import java.io.FileNotFoundException;
import java.io.IOException;

import javax.xml.bind.JAXBException;

import org.jfree.chart.JFreeChart;

import br.ufpe.cin.analysis.plugin.models.ChartDataset;
import br.ufpe.cin.analysis.plugin.entities.Process;

public abstract class Chart< T extends ChartDataset> {
	
	private JFreeChart jchart;
	private T dataset;
	//private String title;
	
	
	public Chart()
	{
		
	}
	
	//It'll create the jchart
	public abstract void init();
	
	public void refresh() 
	{
		this.dataset.makeJFreeChartDataset();
		this.init();
	}
	
	public void refreshFromXml() throws JAXBException, IOException
	{
		this.dataset.loadProcess();
		this.init();
	}


	public JFreeChart getJChart() {
		return jchart;
	}
	
	protected void setJChart(JFreeChart jchart)
	{
		this.jchart = jchart;
	}

	public T getDataset() {
		return dataset;
	}


	public void setDataset(T dataset) {
		this.dataset = dataset;
		this.init();
	}

	/*
	public String getTitle() {
		return title;
	}


	public void setTitle(String title) {
		this.title = title;
		this.init();
	}
	*/
	
	
	
	

}
